﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraTab;
using DevExpress.XtraEditors.Controls;
using DevExpress.Utils;
using DevExpress.XtraEditors;
using DevExpress.XtraTabbedMdi;

namespace ERPBIPRO
{
    public partial class MainForm : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        bool isSanPham = false;
        public MainForm()
        {
            InitializeComponent();
        }
        void InitSkins()
        {
            //SkinHelper.s
        }
        private void MainForm_Load(object sender, EventArgs e)
        {
            //vo toan trung
        }
        //selettape
        private bool SelectTabPage(string cap) {
            foreach (XtraMdiTabPage page in xtraTabbedMdiManager1.Pages)
            {
                if (page.Text.Equals(cap)) {
                    xtraTabbedMdiManager1.SelectedPage = page;
                    return true;
                }
            }
            return false;
        }
        private void bt_sanpham_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SelectTabPage("Danh mục Hàng hóa"))
            {
                DM_HangHoa frhh = new DM_HangHoa();
                frhh.MdiParent = this;
                frhh.Padding = new Padding(2);
                frhh.Show();
            }
        }

        private void bt_loaisanpham_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SelectTabPage("Danh mục Loại sản phẩm"))
            {
                DM_LoaiSanPham frhh = new DM_LoaiSanPham();
                frhh.MdiParent = this;
                frhh.Padding = new Padding(2);
                frhh.Show();
            }
        }

        private void bt_khohang_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SelectTabPage("Danh mục Kho hàng"))
            {
                DM_KhoHang frhh = new DM_KhoHang();
                frhh.MdiParent = this;
                frhh.Padding = new Padding(2);
                frhh.Show();
            }
        }

        private void bt_loainhapxuat_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SelectTabPage("Danh mục Loại nhập xuất"))
            {
                DM_LoaiNhapXuat frhh = new DM_LoaiNhapXuat();
                frhh.MdiParent = this;
                frhh.Padding = new Padding(2);
                frhh.Show();
            }
        }

        private void bt_donvitinh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SelectTabPage("Danh mục Đơn vị tính"))
            {
                DM_DonViTinh frhh = new DM_DonViTinh();
                frhh.MdiParent = this;
                frhh.Padding = new Padding(2);
                frhh.Show();
            }
        }

        private void bt_nhacungcap_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SelectTabPage("Danh mục Nhà cung cấp"))
            {
                DM_NhaCungCap frhh = new DM_NhaCungCap();
                frhh.MdiParent = this;
                frhh.Padding = new Padding(2);
                frhh.Show();
            }
        }

        private void bt_khachhang_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SelectTabPage("Danh mục Khách hàng"))
            {
                DM_KhachHang frhh = new DM_KhachHang();
                frhh.MdiParent = this;
                frhh.Padding = new Padding(2);
                frhh.Show();
            }
        }

        private void bt_nhomkhachhang_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SelectTabPage("Danh mục Nhóm khách hàng"))
            {
                DM_NhomKhachHang frhh = new DM_NhomKhachHang();
                frhh.MdiParent = this;
                frhh.Padding = new Padding(2);
                frhh.Show();
            }
        }

        private void bt_nhapkho_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SelectTabPage("Nhập kho"))
            {
                Kho_NhapKho frhh = new Kho_NhapKho();
                frhh.MdiParent = this;
                frhh.Padding = new Padding(2);
                frhh.Show();
            }
        }
    }
}